const md5 = require('md5');
const User = require('../../db/userSchame');
module.exports = async(req, res) => {
    let usermsgObj = {
        username: req.body.username,
        password: md5(req.body.password),
        age: req.body.age,
        sex: req.body.sex,
        address: req.body.address,
    };
    //   修改用户操作
    try {
        await User.updateOne({ "_id": req.params.userId }, usermsgObj);
        res.redirect('/admin/userlist');
    } catch (error) {
        res.status(500).send('修改失败');
    };

};